<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no">
		<title>绑定会员</title>
		<link rel="stylesheet" href="/static/css/style.css" />

	</head>

	<body>

		<div class="container" id="bindUser">

			<div class="form form-login">
				<div class="unit">
					<i class="icon icon-wode"></i>
					<input type="text" placeholder="请输入您的用户名" v-model="username" />
				</div>
				<div class="unit">
					<i class="icon icon-suo"></i>
					<input :type="passInput" placeholder="请输入您的密码" v-model="password" />
					<i class="icon icon-yanjing" @click="changeInput" :style="eyeColor"></i>
				</div>
				<div class="unit">
					<a class="btn btn-block btn-round bg-primary" @click="doLogin">
						确定
					</a>
					<a  href="/app/wxmp/user/forget" class="right"><i class="icon icon-bangzhu"></i>忘记密码？</a>
				</div>
				<div class="unit unit-btn">
					不是会员？
					<a  href="/app/wxmp/user/register">立即注册</a>
				</div>
			</div>
			

		</div>

	</body>
	<script src="/static/js/mui.min.js"></script>
	<script src="/static/js/vue.min.js"></script>
	<script src="/static/js/zepto.min.js"></script>
	<script src="/static/js/plugins/popup.js"></script>
	<script src="/static/js/plugins/input.js"></script>
	<script type="text/javascript">
		var bindUser = new Vue({
			el: '#bindUser',
			delimiters: ['${', '}'],
			data: {
				passInput: "password",
				
				eyeColor: "",
				username: "",
				password: "",
				
			},
			mounted: function() {

			},

			methods: {
				changeInput() {
					if(this.eyeColor) {
						this.eyeColor = "";
						this.passInput = "password";
					} else {
						this.eyeColor = "color:#333";
						this.passInput = "text";
					}

				},
				
				doLogin() {
					var self = this;
					if(!self.username.trim()) {
						return popup.toast("请输入用户名");

					}

					if(!self.password.trim()) {
						return popup.toast("请输入密码");

					}
					$.post('/app/wxmp/user/login', {
						username: self.username,
						password: self.password
					}, function(res) {
						if(res.errno == 0) {
							location.href="/app/wxmp/user/index"

						} else {
							popup.prompt(res.errmsg);
						}
					});
				},
				

			}

		});
	</script>

</html>